﻿-----------------------------------------------------------------------------
PaneponGUI - Pokémon de Panepon / Pokémon Puzzle Challenge decompression tool
Written 2013 by xdaniel; compression format documented by Joe

Author's website:        http://magicstone.de/dzd/
     ... Twitter:        https://twitter.com/xdanieldzd
The Cutting Room Floor:	 http://tcrf.net/
Jul:                     http://jul.rustedlogic.net/
-----------------------------------------------------------------------------

-------------
 Description
-------------
PaneponGUI is a graphics decompression tool for "Pokémon de Panepon" and "Pokémon Puzzle Challenge"
for the Game Boy Color. It has been created for the purpose of unearthing more leftovers of an
unannounced GBC version of "Panel de Pon", the Japanese Super Nintendo game reskinned overseas as
"Tetris Attack", that eventually became the Pokémon-themed game released internationally.

-------
 Usage
-------
This program can either be used to directly decompress graphics data from the command line, or as a
GUI application that allows browsing the ROM visually and dumping images of the decompressed tiles.

The command line syntax is as follows:
 PaneponGUI.exe <ROM file> <data offset (hex)> <output file>

Example:
 PaneponGUI.exe "Pokémon de Panepon.gbc" 0x3E8FE Decompressed.gb

This command line would decompress the data at offset 0x3E8FE in the file "Pokémon de Panepon.gbc"
to the file "Decompressed.gb".

The program is started in GUI mode if no command line arguments are given, thus ex. when simply
double-clicking the program's executable.

-----------
 Interface
-----------
The main window is separated into three parts: The regular viewing panel on the left, the panel for
decompressed graphics on the right, and the controls in the center.

The left panel shows the uncompressed graphics at the currently selected offset, and basically acts
as a "browser" to move around in the ROM.

Controls when focused:
- Left/right: Move one tile backwards or forwards (16 bytes)
- Up/down: Move one line backwards or forwards (256 bytes)
- Ctrl & Left/Right OR Numpad -/+: Move one byte backwards or forwards
- Page Up/Down: Move one page backwards or forwards (6144 bytes)
- Home/End: Move to the start or end of the ROM
- Ctrl & D: Shortcut for "Decompress" button
- Ctrl & N: Shortcut for "Try Next Block" button

As mentioned before, the right panel shows the most recently decompressed graphics. If nothing is
shown here, and the status bar says "Invalid data", the data at the selected offset couldn't be
decompressed and is likely not compressed data.

The following controls can be found in the center area:

- Offset: The text box shows the currently selected offset. This value changes automatically when
          moving around the ROM using the left-hand panel, and can also be changed manually.

- Decompress: Clicking this button will make the program try to decompress whatever data is at the
              currently selected offset.

- Try Next Block: In certain cases, multiple blocks of compressed data follow right after one
                  another. This button will make the program skip to the end of the currently
                  selected block, then try to decompress from there.

- Auto-decompress: If this is checked and the selected offset is changed, the program will
                   automatically try to decompress the data at the offset.

- Palette editor: The palette used for viewing and saving graphics can be edited by clicking on any
                  of the four colors.

The most recently decompressed tiles can be dumped to an image file from the menu, by clicking on
"Tools", then "Save Image". The palette can also be reset to the default palette by clicking on
"Tools" and "Reset Palette".

In addition, user settings like ex. the last ROM opened, last offset and palette are saved and kept
between sessions.

--------
 Thanks
--------
 - Joe on Jul, for figuring out and documenting the compression format; now I don't need to bundle a
   complete CPU emulator core to decompress the data anymore
 - Xkeeper of Jul and TCRF, for indirectly making me look into the game via a tweet of his
 - The Jul forums and TCRF in general, for just being cool places, I guess!

--------
 Notice
--------
All copyrighted names, materials, etc. used in this application and documentation are copyright of
their respective owners.

Pokémon and related properties - (C) 1995 Nintendo, Creatures and GAME FREAK
Pokémon de Panepon / Pokémon Puzzle Challenge - (C) 2000 Nintendo and Intelligent Systems
